<?php

class ModelPaymentPaymentlog extends Model{

	public function addlog($data){

		$sql = "INSERT INTO `".DB_PREFIX."payment_log`";

		if(!empty($data['order_id'])){
			$set[] = "order_id = '".$data['order_id']."'";
		}

		if(!empty($data['payment_method'])){
			$set[] = "payment_method = '".$data['payment_method']."'";
		}

		if(!empty($data['payment_para'])){
			$set[] = "payment_para = '".$data['payment_para']."'";
		}

		if(!empty($data['interface_file'])){
			$set[] = "interface_file = '".$data['interface_file']."'";
		}

		if(!empty($data['create_datetime'])){
			$set[] = "create_datetime = '".$data['create_datetime']."'";
		}else{
			$set[] = "create_datetime = NOW()";
		}

		if(!empty($set)){
			$sql .= ' SET '.implode(',',$set);

			$this->db->query($sql);

			$payment_id = $this->db->getLastId();

			return $payment_id;
		}else{
			return 0;
		}

	}

}

?>